home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / lblcs.arc / KEY_GETC.ASM < prev    next >
Encoding:
Assembly Source File  |  1985-04-17  |  1022 b   |  54 lines

  1.  
  2.         page    60,132
  3. ;-----------------------------------------------------------------------
  4. ;
  5. ; name        key_getch -- read a char from the keyboard
  6. ;
  7. ; synopsis    int    ch;
  8. ;        ch = key_getch();
  9. ;        scan = ch >> 8;
  10. ;        ascii = ch & 255;
  11. ;
  12. ; description    Waits for a key to be pressed on the keyboard and
  13. ;        returns the character.  Removes character from input 
  14. ;        buffer.  Returns both ASCII char and scan code.
  15. ;        scan code is in the high 8 bits, ASCII in the low 8 bits.
  16. ; Notes:
  17. ;        arrow keys and some others return only scan codes. Shift
  18. ;        keys, control keys and some others do not show up at all
  19. ;         when using this function.
  20. ;
  21. ;----------------------------------------------------------------------
  22.  
  23.  
  24.     include    dos.mac
  25.  
  26.  
  27.     IF    LPROG
  28. X    EQU    6        ;OFFSET OF ARGUMENTS
  29.     ELSE
  30. X    EQU    4        ;OFFSET OF ARGUMENTS
  31.     ENDIF
  32.  
  33.     PSEG
  34.  
  35.  
  36.     PUBLIC    key_getch
  37.  
  38.     IF    LPROG
  39. key_getch    PROC    FAR
  40.     ELSE
  41. key_getch    PROC    NEAR
  42.     ENDIF
  43.  
  44.  
  45.     mov    ah,0
  46.     int    16h        ; call keyboard function    
  47.     ret
  48.  
  49. key_getch    endp
  50.  
  51.     endps
  52.     end
  53.  
  54.